<?php 
if($section == 'access_count') { ?>
	<?php if($period == 'weekly') { ?>
		<script type="text/javascript">
		//  google.setOnLoadCallback(drawChart_access_count_weekly);
		 // function drawChart_access_count_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks', 'Access Counts'],
			<?php
				$i = 1;
				if(isset($access_count_data_weekly))
				{				
					foreach($access_count_data_weekly as $row) {
						if($i == count($access_count_data_weekly))
						{
							$weeks = "Current Week";
						}
						else
						{
							$weeks = "Week ".$i;
						}
						echo "['". $weeks ."', ". $row['total_counts'] ."],";
						$i++;
					}
				}
			?>
			]);
			var options = {
			  title: 'Access Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_access_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($access_count_data_weekly != NULL) { ?>
		<div id="show_access_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>
	
	<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_access_count_monthly);
		  //function drawChart_access_count_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Access Counts'],
			<?php
				$i = 1;
				if(isset($access_count_data_monthly))
				{				
					foreach($access_count_data_monthly as $row) {
						if($i == count($access_count_data_monthly))
						{
							$months = "Current Month";
						}
						else
						{
							$months = "Month ".$i;
						}
						echo "['". $months ."', ". $row['total_counts'] ."],";
						$i++;
					}
				}
			?>
			]);
			var options = {
			  title: 'Access Counts',
			  pointShape: 'circle',
			  pointSize: 5,
			  //curveType: 'function',
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_access_graph_monthly'));
			chart.draw(data, options);				
		//}

		</script>
		<div id="show_access_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>

<?php 
 if($section == 'likes_count') { ?>
	<?php if($period == 'weekly') { ?>

		<script type="text/javascript">
		//  google.setOnLoadCallback(drawChart_liked_count_weekly);
		 // function drawChart_liked_count_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks', 'Like Counts'],
				<?php
					$i = 1;
					if(isset($liked_count_data_weekly))
					{				
						foreach($liked_count_data_weekly as $row) {
							if($i == count($liked_count_data_weekly))
							{
								$weeks = "Current Week";
							}
							else
							{
								$weeks = "Week ".$i;
							}
							echo "['". $weeks ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Like Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_liked_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($liked_count_data_weekly != NULL) { ?>
		<div id="show_liked_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_liked_count_monthly);
		  //function drawChart_liked_count_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Like Counts'],
				<?php
					$i = 1;
					if(isset($liked_count_data_monthly))
					{				
						foreach($liked_count_data_monthly as $row) {
							if($i == count($liked_count_data_monthly))
							{
								$months = "Current Month";
							}
							else
							{
								$months = "Month ".$i;
							}
							echo "['". $months ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Like Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_liked_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_liked_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>

<?php 
if($section == 'flags_count') { ?>
	<?php if($period == 'weekly') { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_flag_count_weekly);
		  //function drawChart_flag_count_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks', 'Flag Counts'],
				<?php
					$i = 1;
					if(isset($flag_count_data_weekly))
					{				
						foreach($flag_count_data_weekly as $row) {
							if($i == count($flag_count_data_weekly))
							{
								$weeks = "Current Week";
							}
							else
							{
								$weeks = "Week ".$i;
							}
							echo "['". $weeks ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Flag Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_flag_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($flag_count_data_weekly != NULL) { ?>
		<div id="show_flag_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_flag_count_monthly);
		  //function drawChart_flag_count_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Flag Counts'],
				<?php
					$i = 1;
					if(isset($flag_count_data_monthly))
					{				
						foreach($flag_count_data_monthly as $row) {
							if($i == count($flag_count_data_monthly))
							{
								$months = "Current Month";
							}
							else
							{
								$months = "Month ".$i;
							}
							echo "['". $months ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Flag Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_flag_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_flag_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>

<?php 
if($section == 'shares_count') { ?>
	<?php if($period == 'weekly') { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_shared_count_weekly);
		  //function drawChart_shared_count_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks','Facebook','Twitter','LinkedIn'],
				<?php
					$i = 1;
					if(isset($shared_count_data_weekly))
					{				
						foreach($shared_count_data_weekly as $row) {
							if($i == count($shared_count_data_weekly))
							{
								$weeks = "Current Week";
							}
							else
							{
								$weeks = "Week ".$i;
							}
							echo "['". $weeks ."', ". $row['facebook'] .", ". $row['twitter'] .", ". $row['linkedin'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Shared Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_shared_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($shared_count_data_weekly != NULL) { ?>
		<div id="show_shared_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_shared_count_monthly);
		  //function drawChart_shared_count_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months','Facebook','Twitter','LinkedIn'],
				<?php
					$i = 1;
					if(isset($shared_count_data_monthly))
					{				
						foreach($shared_count_data_monthly as $row) {
							if($i == count($shared_count_data_monthly))
							{
								$months = "Current Month";
							}
							else
							{
								$months = "Month ".$i;
							}
							echo "['". $months ."', ". $row['facebook'] .", ". $row['twitter'] .", ". $row['linkedin'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Shared Counts',
			  pointShape: 'circle',
			  pointSize: 5,
			  //curveType: 'function',
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_shared_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_shared_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>

<?php 
if($section == 'downloads_count') { ?>
	<?php if($period == 'weekly') { ?>

	<script type="text/javascript">
	  //google.setOnLoadCallback(drawChart_download_count_weekly);
	  //function drawChart_download_count_weekly() {
		var data = google.visualization.arrayToDataTable([
		  ['Weeks', 'Download Counts'],
			<?php
				$i = 1;
				if(isset($download_count_data_weekly))
				{				
					foreach($download_count_data_weekly as $row) {
						if($i == count($download_count_data_weekly))
						{
							$weeks = "Current Week";
						}
						else
						{
							$weeks = "Week ".$i;
						}
						echo "['". $weeks ."', ". $row['total_counts'] ."],";
						$i++;
					}
				}
			?>
		]);
		var options = {
		  title: 'Download Counts',
		  //curveType: 'function',
		  pointShape: 'circle',
		  pointSize: 5,
		  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
		};
		var chart = new google.visualization.LineChart(document.getElementById('show_download_count_graph_weekly'));
		chart.draw(data, options);				
	//}
	</script>
		<?php if($download_count_data_weekly != NULL) { ?>
		<div id="show_download_count_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_download_count_monthly);
		  //function drawChart_download_count_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Download Counts'],
				<?php
					$i = 1;
					if(isset($download_count_data_monthly))
					{				
						foreach($download_count_data_monthly as $row) {
							if($i == count($download_count_data_monthly))
							{
								$months = "Current Month";
							}
							else
							{
								$months = "Month ".$i;
							}
							echo "['". $months ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Download Counts',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_download_count_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_download_count_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>


<?php 
if($section == 'answertime_count') { ?>
	<?php if($period == 'weekly') { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_answer_time_weekly);
		  //function drawChart_answer_time_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks', 'Correct Answer', 'Wrong Answer'],
			<?php
				$i = 1;
				if(isset($answer_time_data_weekly))
				{				
					foreach($answer_time_data_weekly as $row) {
						if($i == count($answer_time_data_weekly))
						{
							$weeks = "Current Week";
						}
						else
						{
							$weeks = "Week ".$i;
						}

						if($row['correctanswertime'] == "")
						{
							$correctanswertime = '0';
						}
						else
						{
							$correctanswertime = $row['correctanswertime'];
						}
						if($row['wronganswertime'] == "")
						{
							$wronganswertime = '0';
						}
						else
						{
							$wronganswertime = $row['wronganswertime'];				
						}
						echo "['". $weeks ."', ". $correctanswertime .", ". $wronganswertime ."],";
						$i++;
					}
				}
			?>
			]);
			var options = {
			  title: 'Answer Time',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_answer_time_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($answer_time_data_weekly != NULL) { ?>
		<div id="show_answer_time_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_answer_time_monthly);
		  //function drawChart_answer_time_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Correct Answer', 'Wrong Answer'],
			<?php
				$i = 1;
				if(isset($answer_time_data_monthly))
				{				
					foreach($answer_time_data_monthly as $row) {
						if($i == count($answer_time_data_monthly))
						{
							$months = "Current Month";
						}
						else
						{
							$months = "Month ".$i;
						}

						if($row['correctanswertime'] == "")
						{
							$correctanswertime = '0';
						}
						else
						{
							$correctanswertime = $row['correctanswertime'];
						}
						if($row['wronganswertime'] == "")
						{
							$wronganswertime = '0';
						}
						else
						{
							$wronganswertime = $row['wronganswertime'];				
						}
						echo "['". $months ."', ". $correctanswertime .", ". $wronganswertime ."],";
						$i++;
					}
				}
			?>
			]);
			var options = {
			  title: 'Answer Time',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_answer_time_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_answer_time_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>


<?php 
if($section == 'correctanswer_count') { ?>
	<?php if($period == 'weekly') { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_correct_answer_counts_weekly);
		  //function drawChart_correct_answer_counts_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks', 'Corrects Answers'],
				<?php
					$i = 1;
					if(isset($correct_answer_counts_graph_weekly))
					{				
						foreach($correct_answer_counts_graph_weekly as $row) {
							if($i == count($correct_answer_counts_graph_weekly))
							{
								$weeks = "Current Week";
							}
							else
							{
								$weeks = "Week ".$i;
							}
							echo "['". $weeks ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Correct Answers',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_correct_answer_counts_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($correct_answer_counts_graph_weekly != NULL) { ?>
		<div id="show_correct_answer_counts_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>

		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_correct_answer_counts_monthly);
		  //function drawChart_correct_answer_counts_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Corrects Answers'],
				<?php
					$i = 1;
					if(isset($correct_answer_counts_graph_monthly))
					{				
						foreach($correct_answer_counts_graph_monthly as $row) {
							if($i == count($correct_answer_counts_graph_monthly))
							{
								$months = "Current Week";
							}
							else
							{
								$months = "Week ".$i;
							}
							echo "['". $months ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Correct Answers',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_correct_answer_counts_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_correct_answer_counts_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>


<?php 
if($section == 'wronganswer_count') { ?>
	<?php if($period == 'weekly') { ?>

		<script type="text/javascript">
		//  google.setOnLoadCallback(drawChart_wrong_answer_counts_weekly);
		//  function drawChart_wrong_answer_counts_weekly() {
			var data = google.visualization.arrayToDataTable([
			  ['Weeks', 'Wrong Answers'],
				<?php
					$i = 1;
					if(isset($wrong_answer_counts_graph_weekly))
					{				
						foreach($wrong_answer_counts_graph_weekly as $row) {
							if($i == count($wrong_answer_counts_graph_weekly))
							{
								$weeks = "Current Week";
							}
							else
							{
								$weeks = "Week ".$i;
							}
							echo "['". $weeks ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Wrong Answers',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_wrong_answer_counts_graph_weekly'));
			chart.draw(data, options);				
		//}
		</script>
		<?php if($wrong_answer_counts_graph_weekly != NULL) { ?>
		<div id="show_wrong_answer_counts_graph_weekly" style="width: 200px; height: 140px;"></div>
		<?php } else {?>
			<div id="" style="width: 200px; height: 140px;">No graph exist for this question</div>
		<?php } ?>

	<?php } else { ?>


		<script type="text/javascript">
		  //google.setOnLoadCallback(drawChart_wrong_answer_counts_monthly);
		  //function drawChart_wrong_answer_counts_monthly() {
			var data = google.visualization.arrayToDataTable([
			  ['Months', 'Wrong Answers'],
				<?php
					$i = 1;
					if(isset($wrong_answer_counts_graph_monthly))
					{				
						foreach($wrong_answer_counts_graph_monthly as $row) {
							if($i == count($wrong_answer_counts_graph_monthly))
							{
								$months = "Current Week";
							}
							else
							{
								$months = "Week ".$i;
							}
							echo "['". $months ."', ". $row['total_counts'] ."],";
							$i++;
						}
					}
				?>
			]);
			var options = {
			  title: 'Wrong Answers',
			  //curveType: 'function',
			  pointShape: 'circle',
			  pointSize: 5,
			  legend: { position: 'right', textStyle: {color: '#000', fontSize: '12px'} }
			};
			var chart = new google.visualization.LineChart(document.getElementById('show_wrong_answer_counts_graph_monthly'));
			chart.draw(data, options);				
		//}
		</script>
		<div id="show_wrong_answer_counts_graph_monthly" style="width: 300px; height: 200px;"></div>
	<?php } ?>
<?php } ?>
